<html>
  <head>
    <title>AmbientLight Generic Sensor cross-origin iframe test</title>
    <script type="text/javascript">
      function start() {
        try {
          let sensor = new AmbientLightSensor();
          // The Generic Sensor API is expected to throw an exception for
          // cross-origin frames.
          fail();
        } catch(e) {
          pass();
        }
      }

      function pass() {
        document.getElementById('status').innerHTML = 'PASS';
        document.location = '#pass';
      }

      function fail() {
        document.location = '#fail';
      }
    </script>
  </head>
  <body onLoad="setTimeout(start, 200)">
    <div id="status">FAIL</div>
  </body>
</html>
